package com.tensquare.recruit.service;

import com.tensquare.recruit.dao.RecruitDao;
import com.tensquare.recruit.pojo.Recruit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class RecruitService {

    @Autowired
    private RecruitDao recruitDao;


    //查询职位推荐列表
    //查询状态为2并以创建日期降序排序，查询前4条记录
    public List<Recruit> findRecommendList() {
        List<Recruit> top4ByStateOrderByCreatetimeDesc = recruitDao.findTop4ByStateOrderByCreatetimeDesc("2");
        return top4ByStateOrderByCreatetimeDesc;
    }
    //最新职位列表
    //查询状态不为0并以创建日期降序排序，查询前12条记录
    public List<Recruit> findNewList() {
        List<Recruit> top12ByStateIsNotOrderByCreatetimeDesc = recruitDao.findTop12ByStateIsNotOrderByCreatetimeDesc("2");
        return top12ByStateIsNotOrderByCreatetimeDesc;
    }
}
